home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_03_06
/
3n06031a
< prev
next >
Wrap
Text File
|
1992-03-29
|
2KB
|
48 lines
Listing 1
/*****************************************************/
/* comboed.c */
/* -- Subclass the EditItem of a ComboBox. */
/*****************************************************/
#include <windows.h>
#include "comboed.h"
FARPROC
LpfnSubclassComboEdit(FARPROC lpfn, HWND hwndCombo)
/*****************************************************/
/* -- If the given ComboBox contains an EditItem, */
/* subclass it with the given window proc. */
/* -- Return the EditItem's original window */
/* procedure, or NULL for failure. */
/* -- lpfn : Procedure instance of subclasser. */
/* -- hwndCombo : ComboBox window handle. */
/*****************************************************/
{
HWND hwndChild;
FARPROC lpfnEdit;
/* Loop over all the child windows of the */
/* ComboBox. Stop if we find an EditItem. */
for (hwndChild = GetWindow(hwndCombo, GW_CHILD);
hwndChild != NULL;
hwndChild = GetWindow(hwndChild, GW_HWNDNEXT))
{
char szClass[10];
GetClassName(hwndChild, szClass,
sizeof szClass);
if (lstrcmpi(szClass, "edit") == 0)
break;
}
if (hwndChild == NULL)
return NULL; /* Must be CBS_DROPDOWNLIST. */
lpfnEdit =
(FARPROC)GetWindowLong(hwndChild, GWL_WNDPROC);
SetWindowLong(hwndChild, GWL_WNDPROC, (LONG)lpfn);
return lpfnEdit;
}